package com.chance.cc.crawler.prod.command.trigger.domain.vm.dcdapp;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import com.chance.cc.crawler.prod.command.job.domain.vm.dcdapp.DCDAppCommonCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.vm.dcdapp.realtime.DCDAppBkNewsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.vm.dcdapp.realtime.DCDAppSeriesNewsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.vm.dcdapp.trace.DCDAppBkNewsTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.vm.dcdapp.trace.DCDAppSeriesNewsTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.trigger.CommonCrawlerSchedulerTrigger;

/**
 * @author lt
 * @version 1.0
 * @date 2021-05-13 14:25:23
 * @email okprog@sina.com
 */
public class DCDAppCommonCrawlerScheduleTrigger extends CommonCrawlerSchedulerTrigger {

    public static void main(String[] args) {

//        publishCommonCrawlerScheduleTriggerInfo(DCDAppBkNewsRealtimeCrawlerSchedulerJob.crawlerScheduler(),
//                "0 0 0/2 * * ? *",
//                "懂车帝资讯板块实时采集每2小时采集一次");
//
        publishCommonCrawlerScheduleTriggerInfo(DCDAppBkNewsTraceCrawlerSchedulerJob.crawlerScheduler(),
                "0 30 0 * * ? *",
                "懂车帝资讯板块追溯采集每天00:30采集一次");

//        publishCommonCrawlerScheduleTriggerInfo(DCDAppSeriesNewsRealtimeCrawlerSchedulerJob.crawlerScheduler(),
//                "0 0 1/4 * * ? *",
//                "懂车帝车系资讯实时采集每2小时采集一次");

//        publishCommonCrawlerScheduleTriggerInfo(DCDAppSeriesNewsTraceCrawlerSchedulerJob.crawlerScheduler(),
//                "0 30 1 * * ? *",
//                "懂车帝车系资讯追溯采集每天01:30采集一次");

    }

    /**
     * 发布懂车帝资讯实时采集trigger info

     */
    public static void publishCommonCrawlerScheduleTriggerInfo(CrawlerJob crawlerJob, String cron, String note){

        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                DCDAppCommonCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                cron,
                note
        );
    }

}
